package com.lsc.admin.demo.bean;

import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.lsc.admin.demo.bean.impl.DefTestBeanImpl;
import com.lsc.admin.demo.bean.impl.MyTestBeanImpl;

/**
 * c接口多实现根据配置装载
 * c适用：根据不同场景使用不同实现
 * @author ln
 *
 */
@Configuration
public class BeanConfig {
	
	@Bean
	@ConditionalOnProperty(name = "swagger.enable", havingValue = "false")
	public ITestBean getDefBean()
	{
		return new DefTestBeanImpl();
	}

	@Bean
	@ConditionalOnProperty(name = "swagger.enable", havingValue = "true")
	public ITestBean getMyBean()
	{
		return new MyTestBeanImpl();
	}
}
